package tote.security;

import java.beans.PropertyVetoException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;

import javax.sql.DataSource;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.mchange.v2.c3p0.ComboPooledDataSource;

public class AppDataSource implements DataSource {
    protected ComboPooledDataSource pds = new ComboPooledDataSource();
    protected final Log log = LogFactory.getLog(getClass());

    public void setUser(String user) {
	pds.setUser(user);
    }

    public void setPassword(String password) {
	pds.setPassword(password);
    }

    public void setJdbcUrl(String jdbcUrl) {
	pds.setJdbcUrl(jdbcUrl);
    }

    public void setMaxPoolSize(int maxPoolSize) {
	pds.setMaxPoolSize(maxPoolSize);
    }

    public void setDriverClass(String driverClass) throws PropertyVetoException {
	pds.setDriverClass(driverClass);
    }

    @Override
    public Connection getConnection() throws SQLException {
	return pds.getConnection();
    }

    @Override
    public Connection getConnection(String username, String password) throws SQLException {
	return pds.getConnection(username, password);
    }

    @Override
    public PrintWriter getLogWriter() throws SQLException {
	return pds.getLogWriter();
    }

    @Override
    public int getLoginTimeout() throws SQLException {
	return pds.getLoginTimeout();
    }

    @Override
    public void setLogWriter(PrintWriter out) throws SQLException {
	pds.setLogWriter(out);
    }

    @Override
    public void setLoginTimeout(int seconds) throws SQLException {
	pds.setLoginTimeout(seconds);
    }

    @Override
    public boolean isWrapperFor(Class<?> iface) throws SQLException {
	return false;
    }

    @Override
    public <T> T unwrap(Class<T> iface) throws SQLException {
	return null;
    }

}
